HTMLPARSER	= gumbowrap.c \
				util.c 

REDIS_CFILE	=	redis.c \
				redisworker.c

CC = gcc -g -fPIC -O0

c_REDIS_FILE_o = $(REDIS_CFILE:.c=.o)
c_HTMLPARSER_FILE_o = $(HTMLPARSER:.c=.o)

LIBPATH	=	-L. \
			-L/home/idd/hotmocha/exlib/lib \
			-L/home/idd/hotmocha/exlib/lib/lib
			#-L/home/hotmocha/exlib/lib

INCLUDEPATH	=	-I. \
			-I/usr/local/include \
			-I/home/idd/hotmocha/exlib/include \
			-I/home/idd/hotmocha/exlib/include/include
			#-I/home/hotmocha/exlib/include

ADDLIB	=  -lgumbo -lcrypto -lspider -lyajl -lcurl


.SUFFIXES:.c
.c.o    :
	$(CC) $(CFLAGS) -c $<  $(INCLUDEPATH)

redis:	$(c_REDIS_FILE_o) $(c_HTMLPARSER_FILE_o) 
	$(CC) -o $@ $(c_REDIS_FILE_o) $(c_HTMLPARSER_FILE_o)  $(LIBPATH) $(ADDLIB) 

clean:
	rm -rf *.o 

#-include $(c_FILE_o:.o=.d) #依赖.d
%.d:%.c
	@set -e;\
	mkdir -p $(BUILD); \
	rm -f $@; $(CC) -MM $< $(INCLUDEFLAGS) >  $@.$$$$; \
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	rm -f $@.$$$$

checkso:
	gcc -o checkso dl.c -ldl
